package org.crag.cafca.logic;

import java.util.Vector;

public class Family 
{
	private String name;
	private Vector<FamilyMember> members;
	
	public Family(String name)
	{
		this.name=name;
		this.members=new Vector<FamilyMember>();
	}
	
	public Vector<FamilyMember> getMembers()
	{
		return members;
	}
	
	public int getNbMembers()
	{
		return members.size();
	}
	
	public void addMember(FamilyMember member)
	{
		this.members.add(member);
	}
	
	public void removeMember(FamilyMember member)
	{
		this.members.remove(member);
	}

	public void removeMember(String familyMemberName) {
		FamilyMember researchedMember=null;
		for (FamilyMember familyMember:members)
		{
			if (familyMember.getName().equals(familyMemberName));
				researchedMember=familyMember;
		}
		
		if (researchedMember!=null)
			this.members.remove(researchedMember);
	}
		
}

